import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'

// https://vite.dev/config/
export default defineConfig({
  cacheDir: '../public/admin',
  plugins: [
    vue(),
    vueDevTools(),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    },
  },
  server: {
        // 代理配置，用于处理前端应用在开发环境中跨域请求的问题
    proxy: {
      // 配置/upload路径的代理
      '/adminApi': {
        //target: 'http://job.cc',
        target:"https://task.simeai.com",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/adminApi/, '/v1/admin/')
        //pathRewrite:{'^//admin':''}
      }
    },
    // 设置请求体的大小限制为50MB，以防止过大的请求体导致的性能问题
    bodySizeLimit: "5000MB",
    port: 81,
  },
  optimizeDeps: {
    include: ['quill']
  },
  base:'/'
})
